package org.cogaen.demo.application;

import java.applet.Applet;

import org.cogaen.java2d.Screen;
import org.cogaen.java2d.CanvasScreen;

public class AppletDemo extends Applet {

	private static final long serialVersionUID = -4162750555319345628L;
	private GameApp gameApp;
	private Screen screen;
	private Thread gameLoop;

	@Override
	public void destroy() {
		super.destroy();
	}

	@Override
	public String getAppletInfo() {
		return "Cogaen Demo, Copyright (c) Roman Divotkey, 2010-2011";
	}

	@Override
	public void init() {
		super.init();
		this.screen = new CanvasScreen(800, 600);
		add(screen.getComponent());
		this.gameApp = new GameApp(this.screen);
	}

	@Override
	public void start() {
		super.start();
		
		this.gameLoop = new Thread(this.gameApp);
		this.gameLoop.start();			
	}

	@Override
	public void stop() {
		this.gameApp.endGame();
		super.stop();
	}

}
